package com.xxgc.moriredis.controller;

import com.xxgc.moriredis.entity.GoodsEntity;
import com.xxgc.moriredis.result.Result;
import com.xxgc.moriredis.service.IGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/demo")
public class DemoController {

    @Autowired
    private IGoodsService iGoodsService;

    @GetMapping("/test")
    public String test(){
        // 每个人写这个的时候这个内容可以不一样
        return "这是石老师用来做负载均衡测试的";
    }

    //查询一下某个商家的商品信息
    @GetMapping("/selectGoodsById")
    public Result selectGoodsById(@RequestParam String id){
        List<GoodsEntity> goodsEntities = iGoodsService.selectGoodsById(id);
        return Result.success(goodsEntities);
    }

}
